package com.haima.utils;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;

public class OrderNotice {

    private static String webhookUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=d8ce02a7-c26f-422c-9f7b-d3439cfe3fd3";



    public static Integer sendMsgMarkDown(String content) {
        JSONObject json = new JSONObject();
        JSONObject markdown = new JSONObject();
        markdown.put("content",content);
        json.put("markdown",markdown);
        json.put("msgtype","markdown");

        String jsonstr = JSONObject.toJSONString(json, new JSONWriter.Feature[0]);
        String ret = HttpRequest.sendPost(webhookUrl, jsonstr);
        JSONObject res = JSONObject.parseObject(ret);
        Integer errcode = res.getInteger("errcode");
        if (errcode == 0) {
            return 0;
        } else {
            return -1;
        }
    }

}
